package com.zhy.springcloud.controller;

import com.zhy.springcloud.enetities.CommonResult;
import com.zhy.springcloud.entities.Payment;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

/**
 * @Author zhy
 * @Description
 * @ClassName PaymentController
 * @Date 2020/12/25 17:33
 **/
@RestController
public class PaymentController {
    @Value("${server.port}")
    private String serverPort;

    public static HashMap<Long, com.zhy.springcloud.entities.Payment> hashMap= new HashMap();

    static {
        hashMap.put(1L, new com.zhy.springcloud.entities.Payment(1L,"test1"));

        hashMap.put(2L, new com.zhy.springcloud.entities.Payment(2L,"test2"));

        hashMap.put(3L, new com.zhy.springcloud.entities.Payment(3L,"test3"));
    }
    @GetMapping(value = "/paymentSQL/{id}")
    public CommonResult paymentSQL(@PathVariable("id") Long id){
        Payment put = hashMap.get(id);
        return new CommonResult(200,"serverPort"+ serverPort,put);
    }




}
